<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title></title>
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<%@ taglib uri="http:dragonsoftbravo.com/cust_tag.tld" prefix="page"%>

<%
	String path = request.getContextPath();
	request.setAttribute("path", path);
%>

<link rel="stylesheet" href="${path}/res/css/bootstrap.min.css" />
<link rel="stylesheet" href="${path}/res/css/bootstrap-responsive.min.css" />
<link rel="stylesheet" href="${path}/res/css/matrix-style.css" />
<link rel="stylesheet" href="${path}/res/css/matrix-media.css" />
<link rel="stylesheet" href="${path}/res/font-awesome/css/font-awesome.css" />
<link rel="stylesheet" href="${path}/res/css/jquery.gritter.css" />
<link rel="stylesheet" href="${path}/res/css/select2.css" />
<link rel="stylesheet" href="${path}/res/css/uniform.css" />

<script src="${path}/res/js/jquery.min.js"></script>
<script src="${path}/res/js/bootstrap.min.js"></script>
<script src="${path}/res/js/jquery-ui.min.js"></script>
<script src="${path}/res/js/matrix.js"></script>
<script src="${path}/res/js/jquery.gritter.min.js"></script>
<script src="${path}/res/js/jquery.validate.js"></script>
<script src="${path}/res/js/jquery.uniform.js"></script>
<script src="${path}/res/js/select2.min.js"></script>
<script src="${path}/res/js/jquery.dataTables.min.js"></script>
<script type="text/javascript" src="${path}/res/js/jquery.blockUI.js"></script>
<script type="text/javascript" src="${path}/res/js/jquery.form.js"></script>

<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http:dragonsoftbravo.com/cust_tag.tld" prefix="page"%>
<script>
	$(function() {
		$('input[type=checkbox],input[type=radio],input[type=file]').uniform();
	});

	
	function send() {
		var name = $("#sendFile").val();
		if(name==null||name==''){
			alert("请选择文件.");
			return;
		}
		
		if (isImage(name)) {
			$("#form1").attr("action","${path}/cal/send");
			$("#form1").submit();
			return;
		} else {
			alert("请上传excel或csv文件.");
		}
	}
	
	function download2() {
		var name = $("#memberLevelFile").val();
		if(name==null||name==''){
			alert("请选择会员分级-产品注册文件.");
			return;
		}
		
		name = $("#keyModelFile").val();
		if(name==null||name==''){
			alert("请选择重点型号文件.");
			return;
		}
		
		name = $("#blackListFile").val();
		if(name==null||name==''){
			alert("请选择黑名单文件.");
			return;
		}
		
		if (isImage(name)) {
			$("#form1").attr("action","${path}/cal/downloadMemberLevelReport");
			$("#form1").submit();
			return;
		} else {
			alert("请上传excel或csv文件.");
		}
	}
	
	
	function download3() {
		var name = $("#braviaFile").val();
		if(name==null||name==''){
			alert("请选择Bravia渠道文件.");
			return;
		}
		
		name = $("#braviaPointFile").val();
		if(name==null||name==''){
			alert("请选择Bravia成长值文件.");
			return;
		}
		
		
		if (isImage(name)) {
			$("#form2").attr("action","${path}/cal/downloadBraviaFileExt");
			$("#form2").submit();
			return;
		} else {
			alert("请上传excel或csv文件.");
		}
	}
	
	
	function download4() {
		var name = $("#braviaFile").val();
		if(name==null||name==''){
			alert("请选择Bravia渠道文件.");
			return;
		}
		
		name = $("#braviaPointFile").val();
		if(name==null||name==''){
			alert("请选择Bravia成长值文件.");
			return;
		}
		
		
		if (isImage(name)) {
			$("#form2").attr("action","${path}/cal/downloadBraviaReport");
			$("#form2").submit();
			return;
		} else {
			alert("请上传excel或csv文件.");
		}
	}
	
	
	function isImage(name) {
		return true;
 		var result = false;
 		alert(name);
		if (name) {
			var reg = /\.xlsx$|\.xls$|\.csv$|\.csvx$/i;
			result = reg.test(name);
		}
		alert(result);
		return result;
	};
</script>


<body>

	<div id="content">
		<div class="container-fluid">
			
		<div class="widget-box">
          <div class="widget-title"> <span class="icon"> <i class="icon-th"></i> </span>
            <h5>会员分级-产品注册</h5>
          </div>
          
		  <div class="form-horizontal ">
		  
		  <form id="form1" class="span12" action="${path}/cal/send" enctype="multipart/form-data" method="post">
			<div class="controls controls-row" style="margin-left:0px;">
				名单:<input type="file" id="sendFile" name="sendFile">
			</div>	
			<div class="controls controls-row" style="margin-left:0px;">
				<input type="button"  class="btn btn-mini btn-primary" onclick="send();" value="发送">
			</div>	
			
			</form>
			
		</div>
			
		
		</div>
		
		
		<div class="widget-box">
          <div class="widget-title"> <span class="icon"> <i class="icon-th"></i> </span>
            <h5>Bravia 产品注册</h5>
          </div>
          
		  <div class="form-horizontal ">
		  
		  <form id="form2" class="span12" action="${path}/cal/downloadBraviaFileExt" enctype="multipart/form-data" method="post">
			<div class="controls controls-row" style="margin-left:0px;">
				渠&nbsp;道&nbsp;:<input type="file" id="braviaFile" name="braviaFile" />
			</div>	
			<div class="controls controls-row" style="margin-left:0px;">
				成长值:<input type="file" id="braviaPointFile" name="braviaPointFile">
			</div>	
			<div class="controls controls-row" style="margin-left:0px;">
				<input type="button"  class="btn btn-mini btn-primary" onclick="download3();" value="详情数据">
				<input type="button"  class="btn btn-mini btn-primary" onclick="download4();" value="合计数据">
			</div>	
			
			</form>
			
		</div>
			
		
		</div>
	</div>

</body>